﻿@model GPS.ENTITYS.CrudModelSLLDT

@{
    ViewBag.Title = "Thêm mới Lưu Lượng Đào Tạo";
}

<style type="text/css">
    .btn-file {
        position: relative;
        overflow: hidden;
    }

        .btn-file input[type=file] {
            position: absolute;
            top: 0;
            right: 0;
            min-width: 100%;
            min-height: 100%;
            font-size: 100px;
            text-align: right;
            filter: alpha(opacity=0);
            opacity: 0;
            background: red;
            cursor: inherit;
            display: block;
        }

    input[readonly] {
        background-color: white !important;
        cursor: text !important;
    }
</style>
<div class="modal-header fdb-panel-header-10">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h5 class="modal-title" id="myModalLabel">Thêm mới Lưu Lượng Đào Tạo</h5>
</div>
@using (Html.BeginForm("Create1", "GPS_LuuLuongDaoTao", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
     <div class="modal-body fdb-panel-body-0">
       <div id="tabs-1">
        @Html.Hidden("IsEdit", 0)
        <fieldset class="fs_body">
            <legend class="head_title">Thông Tin Lưu Lượng Đào Tạo</legend>
            <div class="row margin-top-05">

            </div>
           
            <fieldset class="fs_body">
                <legend class="head_title">Thông Tin thêm mới</legend>
                <div class="row margin-top-05">

                    <div class="col-md-2 control-label">
                        Mã đơn vị:
                    </div>
                    <div class="col-md-4">
                        @Html.DropDownListFor(model => model.LLDT_DVGTVT_MA, (SelectList)ViewBag.lstDVGTVT, "Lựa Chọn", new { @class = "form-control", @Style="width:500px"})
                    </div>

                </div>
                <div class="row margin-top-05">
                    <div class="col-md-2 control-label">
                        Hạng GPLX:
                    </div>
                    <div class="col-md-4">
                        @Html.DropDownListFor(model => model.LLDT_HGPLX_MA, (SelectList)ViewBag.lstHangGP, "Lựa Chọn", new { @class = "form-control" })
                    </div>
                </div>
                <div class="row margin-top-05">
                    <div class="col-md-2 control-label">
                        Lưu Lượng:
                    </div>
                    <div class="col-md-4">
                        @Html.TextBoxFor(model => model.LLDT_LUULUONG, new { @class = "form-control" })
                    </div>
                </div>
                <div class="row margin-top-05">
                    <div class="col-md-2 control-label">
                        Mô Tả
                    </div>
                    <div class="col-md-8">
                        @Html.TextAreaFor(model => model.LLDT_MOTA, new { @class = "form-group", @rows = 5, @style = "width:100%;max-width:100%;" })
                    </div>
                </div>
                <div class="row margin-top-05">
                    <div class="col-md-2 control-label">
                        Trạng Thái:
                    </div>
                    <div class="col-md-4">
                        @Html.DropDownListFor(model => model.LLDT_ACTIVE, new List<SelectListItem>
                                {
                                    new SelectListItem() {Text = "--Lựa Chọn--", Value=""},
                                    new SelectListItem() {Text = "Không Hiệu Lực", Value="0"},
                                    new SelectListItem() {Text = "Hiệu Lực", Value="1"}

                                }, new { @class = "form-control" })
                    </div>
                </div>

                <div class="row margin-top-05">
                    <div class="col-md-2 control-label">
                        Người nhập:
                    </div>
                    <div class="col-md-4">
                        @Html.TextBoxFor(model => model.LLDT_NGUOINHAP, new { @class = "form-control" })
                    </div>
                </div>
                <div class="row margin-top-05">
                    <div class="col-md-2 control-label">
                        Ngày nhập:
                    </div>
                    <div class="col-md-4">
                        @Html.TextBoxFor(model => model.LLDT_NGAYNHAP, new { @class = "form-control", @id = "pNGAYNHAP" })
                    </div>
                </div>
            </fieldset>
        </fieldset>
    </div>
      </div>   
    <br />
    <div class="row  margin-top-05 Action_FormDetail">
        <button type="submit" class="btn btn-danger btn-sm">
            <span class="glyphicon glyphicon-floppy-disk"></span> Cập nhật
        </button>
        <button class="btn btn-warning" data-dismiss="modal">Đóng lại</button>
    </div>

}
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
<script src="~/Scripts/datepicker.js"></script>
<script src="~/Scripts/jquery-ui-1.11.4.js"></script>
<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/jquery.maskMoney.js"></script>
<script src="~/Scripts/jquery.number.js"></script>
<script src="~/Scripts/jquery.masknumber.js"></script>
<script src="~/Scripts/moment.js"></script>

<link href="~/Scripts/select2.css" rel="stylesheet" />
<link href="~/Scripts/select2.min.css" rel="stylesheet" />
<script src="~/Scripts/select2.js"></script>

<script type="text/javascript">

    // Voi jQuery 1.9 > thi chi validate gia tri trong active tab
    // Muon validate nhung gia tri trong cac tab khac nua thi dung jquery.validate 1.8.1 or 1.7


    // mask edit cho truong ngay thang (su dung jquery.maskedinput)


    function ToJavaScriptDate(value) {
        if (value != null) {
            var pattern = /Date\(([^)]+)\)/;
            var results = pattern.exec(value);
            var dt = new Date(parseFloat(results[1]));
            return dt.getDate() + "/" + (dt.getMonth() + 1) + "/" + dt.getFullYear();
        }
        return null;
    }
</script>

<script type='text/javascript'>
    $(document).on('change', '.btn-file :file', function () {
        var input = $(this),
            numFiles = input.get(0).files ? input.get(0).files.length : 1,
            label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
        input.trigger('fileselect', [numFiles, label]);
    });

    function preview_image(event) {
        var reader = new FileReader();
        reader.onload = function () {
            var output = document.getElementById('output_image');
            output.src = reader.result;
        }
        reader.readAsDataURL(event.target.files[0]);
    }
    //$("#pNGAYNHAP").datepicker({
    //    changeMonth: true,
    //    changeYear: true,
    //    dateFormat: 'dd/mm/yy'
    //});
    //$("#pNGAYNHAP").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });

    $("#pNGAYNHAP").datepicker({
        changeMonth: true,
        changeYear: true,

        dateFormat: 'dd/mm/yy'
    });
    $("#pNGAYNHAP").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });
</script>

<script type="text/javascript">
</script>

@Styles.Render("~/Content/themes/base/css")

<script type="text/javascript">
    $(document).ready(function () {


        var pageSize = 20;
        var optionListUrl = '@Url.Action("Select2_DVGTVT_Search", "GPS_Ajax")';

        $('#LLDT_DVGTVT_MA').select2(
                {
                    ajax: {
                        delay: 50,
                        url: optionListUrl,
                        dataType: 'json',

                        data: function (params) {
                            /// params.page = params.page || 1;
                            return {
                                searchTerm: params.term
                            };
                        },
                        processResults: function (data, params) {

                            return {
                                results: data.Results
                            };
                        }
                    },
                    placeholder: "-- Chọn  --",
                    minimumInputLength: 2,
                    allowClear: true,
                    language: { inputTooShort: function () { return 'Nhập lớn hơn 2 ký tự để tìm kiếm '; } }
                });

        $('.btn-file :file').on('fileselect', function (event, numFiles, label) {

            var input = $(this).parents('.input-group').find(':text'),
                log = numFiles > 1 ? numFiles + ' files selected' : label;

            if (input.length) {
                input.val(log);
            } else {
                if (log) alert(log);
            }
        });
    })
</script>

